<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'alocacao-form',
	'enableAjaxValidation'=>false,
)); ?>
<?php echo $this->renderPartial('../layouts/mensagemErro', array('model' => $model)); ?>
	<p class="note">Campos com <span class="required">*</span> são obrigatórios.</p>

	<?php echo $form->errorSummary($model); ?>

        <!--
            <?php echo $form->textField($model,'DT_DIA'); ?>
            <?php echo $form->textField($model,'HR_INI'); ?>
            <?php echo $form->textField($model,'HR_FIM'); ?>
        -->
        
        <div class="row">
            <?php echo $form->labelEx($modelP,'ID_PREDIO'); ?>
            <?php
                $dados = array('-1'=>'Selecione');
                $dados += $modelA->getPredios();
                echo CHtml::dropDownList('ID_PREDIO','', $dados,
                        array(
                            'ajax' => array(
                                'type'=>'POST', //request type
                                'url'=>CController::createUrl('alocacao/ambientesdinamicos'), //url to call.
                                //Style: CController::createUrl('currentController/methodToCall')
                                'update'=>'#Alocacao_ID_AMBIENTE', //selector to update
                                //'data'=>'js:javascript statement' 
                                //leave out the data key to pass all form values through
                                )
                        ));
            ?>
            <?php echo $form->error($modelP,'ID_PREDIO'); ?>
        </div>
        
	<div class="row">
            <?php echo $form->labelEx($model,'ID_AMBIENTE'); ?>
            <?php
                echo $form->dropDownList($model,'ID_AMBIENTE', array());
            ?>
            <?php echo $form->error($model,'ID_AMBIENTE'); ?>
	</div>
        
        

	<div class="row">
            <?php echo $form->labelEx($model,'DT_DIA'); ?>
            <?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $this->widget('CJuiDateTimePicker',array(
                    'model'=>$model, //Model object
                    'attribute'=>'DT_DIA', //attribute name
                    'mode'=>'date', //use "time","date" or "datetime" (default)
                    'options'=>array(
                        'minDate'=> '0',
                    ) // jquery plugin options
                ));
            ?>
            <?php echo $form->error($model,'DT_DIA'); ?>
	</div>

	<div class="row">
            <?php echo $form->labelEx($model,'HR_INI'); ?>
            <?php
                $dados = MethodUtils::getArrayHora();
                echo $form->dropDownList($model,'HR_INI', $dados); 
            ?>
            <?php echo $form->error($model,'HR_INI'); ?>
	</div>

	<div class="row">
            <?php echo $form->labelEx($model,'HR_FIM'); ?>
            <?php
                $dados = MethodUtils::getArrayHora();
                echo $form->dropDownList($model,'HR_FIM', $dados); 
            ?>
            <?php echo $form->error($model,'HR_FIM'); ?>
	</div>

	<div class="row">
            <?php echo $form->labelEx($model,'ID_USO'); ?>
            <?php
                $dados = $modelAU->getUsos();
                echo $form->dropDownList($model,'ID_USO', $dados); 
            ?>
            <?php echo $form->error($model,'ID_USO'); ?>
	</div>

	<div class="row">
            <?php echo $form->hiddenField($model,'ID_USUARIO', array('value'=>Yii::app()->user->getState("identity")->getId())); ?>
	</div>

	<div class="row">
            <?php if (Yii::app()->user->getState("identity")->isAdmin()):?>
                <?php echo $form->labelEx($model,'TX_INTERESSADO');?>
                <?php echo $form->textField($model,'TX_INTERESSADO',array('size'=>60,'maxlength'=>80));?>
                <a href="<?php echo Yii::app()->createAbsoluteUrl('usuario/popupRadio').'&KeepThis=true&TB_iframe=true&height=500&width=500'?>" title="Adicionar Disciplina"
                   class="thickbox"
                   >
                    <img src="<?php echo Yii::app()->request->baseUrl.'/images/clip.png'?>"/>
                </a>
                <?php echo $form->error($model,'TX_INTERESSADO');?>
            <?php else: ?>
                <?php $usu = $modelU->findByAttributes(array('ID_USUARIO'=>Yii::app()->user->getState("identity")->getId()));?>
                <?php echo $form->hiddenField($model,'TX_INTERESSADO', array('value'=>$usu->TX_NOME));?>
            <?php endif; ?>
	</div>

	<div class="row">
            <?php echo $form->labelEx($model,'TX_DESCRICAO'); ?>
            <?php echo $form->textField($model,'TX_DESCRICAO',array('size'=>60,'maxlength'=>255)); ?>
            <a href="<?php echo Yii::app()->createAbsoluteUrl('disciplina/popupRadio').'&KeepThis=true&TB_iframe=true&height=500&width=500'?>" title="Adicionar Disciplina"
               class="thickbox"
               >
                <img src="<?php echo Yii::app()->request->baseUrl.'/images/clip.png'?>"/>
            </a>
            <?php echo $form->error($model,'TX_DESCRICAO'); ?>
	</div>

	<div class="row buttons">
            <?php echo CHtml::submitButton($model->isNewRecord ? 'Criar' : 'Salvar'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->